import type { ProductForm } from './model';

import type { ID, IDS, PageQuery } from '#/api/common';

import { requestClient } from '#/api/request';

/**
 * 产品列表
 * @param params
 */
export function getProductList(params?: PageQuery) {
  return requestClient.get('/iot/product/page', { params });
}
/**
 * 修改产品
 * @param data
 */
export function updateProduct(data: Partial<ProductForm>) {
  return requestClient.postWithMsg('/iot/product/update', data);
}
/**
 * 新增产品
 * @param data
 */
export function addProduct(data: Partial<ProductForm>) {
  return requestClient.postWithMsg('/iot/product/add', data);
}

/**
 * 删除产品
 * @param id
 * @returns
 */

export function removeProduct(id: ID | IDS) {
  return requestClient.post(`/iot/product/remove?id=${id}`);
}

/**
 * 产品详情
 * @param id
 */
export function getProductDetail(id: ID | IDS) {
  return requestClient.get(`/iot/product/detail?id=${id}`);
}
/**
 * 产品下拉
 * @returns []
 */

export function productSelect() {
  return requestClient.get('/iot/product/select');
}
